package org.dbrd.util;

public class Tracer {
	
	private static final Tracer INSTANCE = new Tracer();
	
	public static void switchOn() {
		INSTANCE.on();
	}
	
	public static void switchOff() {
		INSTANCE.off();
	}
	
	
	public static void sinfo(String line) {
		INSTANCE.info(line);
	}
	
	public static void sEnbaleInfo() {
		INSTANCE.enableInfo();
	}
	
	public static void sDisableInfo() {
		INSTANCE.disableInfo();
	}
	
	public static void ssevere(String line) {
		INSTANCE.severe(line);
	}

	public static void sEnableSevere() {
		INSTANCE.enableSevere();
	}
	
	public static void sDisableSevere() {
		INSTANCE.disableSevere();
	}
	
	public static void sdebug(String line) {
		INSTANCE.debug(line);
	}
	
	public static void sEnableDebug() {
		INSTANCE.enableDebug();
	}
	
	public static void sDisableDebug() {
		INSTANCE.disableDebug();
	}
	
	private boolean debug = true;
	
	private boolean info = true;
	
	private boolean severe = true;
	
	public void off() {
		this.debug = false;
		this.info = false;
		this.severe = false;
	}
	
	public void on() {
		this.debug = true;
		this.info = true;
		this.severe = true;
	}
	
	public void enableDebug() {
		this.debug = true;
	}
	
	public void disableDebug() {
		this.debug = false;
	}
	
	public void enableInfo() {
		this.info = true;
	}
	
	public void disableInfo() {
		this.info = false;
	}
	
	public void enableSevere() {
		this.severe = true;
	}
	
	public void disableSevere() {
		this.severe = false;
	}
	
	public void debug(String s) {
		if (this.debug) {
			System.out.println("[D] " + s);
		}
	}
	
	public void info(String s) {
		if (this.info) {
			System.out.println("[I] " + s);
		}
	}
	
	public void severe(String s) {
		if (this.severe) {
			System.err.println("[S] " + s);
		}
	}
	
	
}
